package com.hinacom.pix.web.controller;

import ca.uhn.hl7v2.HL7Exception;
import com.hinacom.pix.client.PDQClient;
import com.hinacom.pix.client.PDQConsumer;
import com.hinacom.pix.entity.PDQQueryParameter;
import com.hinacom.pix.entity.Patient;
import com.hinacom.pix.enums.ESex;
import com.hinacom.pix.web.vo.PixData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;

/**
 * Created by fyu on 2016/8/22.
 */
@Controller
@RequestMapping("pdq-client")
public class PDQClientController {
    @RequestMapping("")
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
        PixData vo = new PixData();
        ModelAndView mv = new ModelAndView("pdq-client");
        mv.addObject("vo",vo);
        return mv;
    }


    @RequestMapping("send")
    public ModelAndView send(String input) throws ParseException, HL7Exception {
        PDQClient pdqClient = new PDQClient();
        String result = pdqClient.sendMessage(input);

        ModelAndView mv = new ModelAndView("pdq-client");
        return mv;
    }

}
